import sys
import os
import re
#检验是否全是中文字符
def is_all_chinese(strs):
    for _char in strs:
        if not '\u4e00' <= _char <= '\u9fa5':
            return False
    return True

#检验是否含有中文字符
def is_contains_chinese(strs):
    for _char in strs:
        if '\u4e00' <= _char <= '\u9fa5':
            return True
    return False

#获取指定目录中的所有文件
def getAllFilePath(path, filePaths=[]):
    if not os.path.exists(path):
        print("no this path: %s" %path)
        return False

    for root,dirs,files in os.walk(path):
        #文件存入列表
        if files:
            for file in files:
                filePath = os.path.join(root,file)
                filePaths.append(filePath)
        #如果有子目录，则遍历子目录
        if dirs:
            for zdir in dirs:
                zdirPath = os.path.join(root,zdir)
                print("子目录%s" %zdirPath)
                getAllFilePath(zdirPath,filePaths)
        return filePaths

#去除指定字符之间的内容
def clearContentWithSpecialCharacter(content):
    
    arr = ['[',']','【','】']
    for i in arr:
        content = content.replace(i,"{")

    # 分组标定，替换，
    pattern = re.compile(r'({)(.*)({)')
    # 如果想包括两个l，则用pattern.sub(r\1''\3,Content)
    result = pattern.sub(r'',content)
    return result